package yw.android.jokes;

import java.util.Random;


import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class TheJokesActivity extends Activity implements OnClickListener
{
	private String[] myString;
	private static final Random rgenerator=new Random();
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button button1=(Button)this.findViewById(R.id.button1);
        button1.setOnClickListener(this);
    }
    
	@Override
	public void onClick(View view) {
		// TODO Auto-generated method stub
		Resources res =getResources();
        myString=res.getStringArray(R.array.jokes);
        String q = myString[rgenerator.nextInt(myString.length)];
		TextView tw=(TextView)findViewById(R.id.textview1);
    	tw.setVisibility(0);
    	tw.setText(q);
		
	}

	
}